﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;

namespace HarveyNash.RefactoringAndCodeSmell.Refactoring.ConsolidateDuplicateConditionalFragments
{
    public class Before
    {
        public void ProcessApprovalAction(int leaveRequestId, bool approved)
        {
            if (approved)
            {
                MailMessage message = new MailMessage();
                message.From = GetRecipientAddress(leaveRequestId);
                message.To.Add("leavesystem@harveynash.vn");
                message.Subject = GetApproveSubject();
                message.Body = GetApproveBody();

                SendMail(message);
            }
            else
            {
                MailMessage message = new MailMessage();
                message.From = GetRecipientAddress(leaveRequestId);
                message.To.Add("leavesystem@harveynash.vn");
                message.Subject = GetRejectSubject();
                message.Body = GetRejectBody();

                SendMail(message);
            }
        }

        private MailAddress GetRecipientAddress(int leaveRequestId)
        {
            //GetRecipientAddress code
            //...
            throw new NotImplementedException();
        }

        private string GetRejectBody()
        {
            //GetRejectBody code
            //...
            throw new NotImplementedException();
        }

        private string GetRejectSubject()
        {
            //GetRejectSubject code
            //...
            throw new NotImplementedException();
        }

        private string GetApproveBody()
        {
            //GetApproveBody code
            //...
            throw new NotImplementedException();
        }

        private string GetApproveSubject()
        {
            //GetApproveSubject code
            //...
            throw new NotImplementedException();
        }

        private void SendMail(MailMessage message)
        {
            //send mail 
            //...
            throw new NotImplementedException();
        }
    }
}
